<%--
  Created by IntelliJ IDEA.
  User: fyf
  Date: 2018/11/9
  Time: 19:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
  String path = request.getContextPath();
 /* String basePath = httpServletRequest.getScheme() + "://" + httpServletRequest.getServerName() + ":" +
      httpServletRequest.getServerPort() + "/" + httpServletRequest.getContextPath();*/
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() +
      "/" + request.getContextPath();
  request.setAttribute("basePath",basePath);

%>
<html>
<head>
  <title>测试</title>
  <link rel="stylesheet" href="https://apps.bdimg.com/libs/bootstrap/3.2.0/css/bootstrap.min.css">
  <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>

<input type="text" id="test" name="test">
<button class="btn btn-primary" >提交</button>
返回结果
<h2>${test}</h2>
<h1>${basePath}</h1>
<script>
  $(function () {
      var utest = encodeURI($('input').val());

      $('button').click(function () {
          window.location.href="test.go?test="+utest;
      });

  });


</script>
</body>
</html>
